﻿using System;
using System.Threading;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Emailtester : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        sendEmail.EmailService mailer = new sendEmail.EmailService();
        mailer.sendEmail("Kayla.eucken@gmail.com", "Hello", "The time is: " + DateTime.Now);
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        SendEmailNotification emailSender = new SendEmailNotification();
        AsyncReserveNote dlgt = new AsyncReserveNote(emailSender.sendEmailNotificationofReservedBookAvailable);

        DateTime start = DateTime.Now;
        IAsyncResult ar = dlgt.BeginInvoke(null,null);

        // Poll while simulating work.
        while (ar.IsCompleted == false)
        {
            Thread.Sleep(10);
        }

        // Call EndInvoke to Wait for the asynchronous call to complete,
        // and to retrieve the results.
        bool ret = dlgt.EndInvoke(ar);
        DateTime finish = DateTime.Now;
        Label1.Text = "Done: " + ret +"\n Started: "+start.ToLongTimeString()+"\n Finished: "+finish.ToLongTimeString();
    }
}
